import storage from '../libs/storage'
const state = {
  authUser: storage.getItem('authUser'),
  access_token: storage.getItem('access_token')
}
const mutations = {
  SET_USER_DATA (state, payload) {
    state.authUser = payload
  },
  SET_ACCESS_TOKEN (state, payload) {
    state.access_token = payload
  }
}
const actions = {
  setUserData ({commit}, payload) {
    commit('SET_USER_DATA', payload)
  },
  setAccessToken ({commit}, payload) {
    commit('SET_ACCESS_TOKEN', payload)
  }
}
const getters = {
  authUser: state => {
    return state.authUser
  },
  access_token: state => {
    return state.access_token
  }
}
export default {
  state, mutations, actions, getters
}
